package com.ship.dispatch.service.treaShipNetwork.impl;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.ship.common.business.service.impl.BaseServiceImpl;
import com.ship.dispatch.bean.IshShipBaseExtend;
import com.ship.dispatch.bean.treaShipNetwork.IhsShipBase;
import com.ship.dispatch.mapper.treaShipNetwork.IhsShipBaseMapper;
import com.ship.dispatch.service.treaShipNetwork.IhsShipBaseService;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class IhsShipBaseServiceImpl extends BaseServiceImpl<IhsShipBaseMapper, IhsShipBase> implements IhsShipBaseService {

    @Override
    public List<IhsShipBase> queryShipBase(Date startTime, Date endTime) {
        String startDate = DateUtil.format(startTime, DatePattern.NORM_DATE_FORMATTER);
        String endDate = DateUtil.format(endTime, DatePattern.NORM_DATE_FORMATTER);
        List<IhsShipBase> shipBaseList = baseMapper.queryShipBaseList(startDate,endDate);
        return shipBaseList;
    }

    @Override
    public List<IhsShipBase> queryShipBaseList() {
        List<IhsShipBase> shipBaseList = baseMapper.queryShipBaseAll();
        return shipBaseList;
    }

    @Override
    public List<IshShipBaseExtend> selectInMysql(Date startTime,Date endTime) {
        String startDate = DateUtil.format(startTime, DatePattern.NORM_DATE_FORMATTER);
        String endDate = DateUtil.format(endTime, DatePattern.NORM_DATE_FORMATTER);
        List<IshShipBaseExtend> shipBaseList = baseMapper.selectInMysql(startDate,endDate);
        return shipBaseList;
    }

    @Override
    public List<IshShipBaseExtend> selectInMysqlList() {
        List<IshShipBaseExtend> shipBaseList = baseMapper.selectInMysqlAll();
        return shipBaseList;
    }

    @Override
    public List<IhsShipBase> queryShipType(Date startTime, Date endTime) {
        String startDate = DateUtil.format(startTime, DatePattern.NORM_DATE_FORMATTER);
        String endDate = DateUtil.format(endTime, DatePattern.NORM_DATE_FORMATTER);
        List<IhsShipBase> shipBaseList = baseMapper.queryShipTypeList(startDate,endDate);
        return shipBaseList;
    }

    @Override
    public List<IhsShipBase> queryShipTypeList() {
        List<IhsShipBase> shipBaseList = baseMapper.queryShipTypeAll();
        return shipBaseList;
    }
}
